//
//  CZQHomePageSectionHead.m
//  coachmanage
//
//  Created by 众拳科技 on 2018/3/21.
//  Copyright © 2018年 众拳科技. All rights reserved.
//

#import "CZQHomePageSectionHead.h"

@implementation CZQHomePageSectionHead
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.backgroundColor = CSWhiteColor;
        
        UIView *sepView = [UIView new];
        sepView.backgroundColor = ButtonBackGroundColor;
        [self addSubview:sepView];
        self.sepView = sepView;
        
        /**
         title
         */
        UILabel *title = [[UILabel alloc] init];
        title.text = @"关于TA";
        title.font = TitleBoldFont;
        title.textColor = BlackColor;
        [self addSubview:title];
        self.titleLabe = title;
        /**
         多少
         */
        UILabel *howLable = [[UILabel alloc] init];
        howLable.text = @"·近七天";
        howLable.font = MidFont;
        howLable.textColor = GrakColor;
        [self addSubview:howLable];
        self.howLabe = howLable;
        
        /**
         更多
         */
        UIButton *moreBtn = [[UIButton alloc] init];
        [moreBtn setTitleColor:GrakColor];
        [moreBtn setTitle:@"更多"];
        moreBtn.titleLabel.font = MidBigFont;
        [self addSubview:moreBtn];
        self.moreBtn = moreBtn;
        
        
        
        [self setConstraints];
    }
    return self;
}

-(void)setConstraints
{
    [self.sepView mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self).offset(20);
        
        make.centerY.mas_equalTo(self.titleLabe);
        
        make.height.mas_equalTo(30);
        
        make.width.mas_equalTo(2);
        
    }];
    
    [self.titleLabe mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.sepView.mas_right).offset(10);
        
        make.top.mas_equalTo(self).offset(10);
        
        make.bottom.mas_equalTo(self).offset(-10);
        
        
        
    }];
    
    [self.howLabe mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.centerY.mas_equalTo(self.titleLabe);
        
        make.left.mas_equalTo(self.titleLabe.mas_right).offset(5);
        
    }];
    
    [self.moreBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.centerY.mas_equalTo(self.titleLabe);
        
        make.right.mas_equalTo(self).offset(-15);
        
    }];
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
